import java.util.Scanner;

/**
 * Created by dllo on 18/3/29.
 */
public class Question02 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("输入年份");
        int years = scanner.nextInt();
        System.out.println("输入月份");
        int months = scanner.nextInt();
        System.out.println("输入日期");
        int day = scanner.nextInt();
        int sum = 0;

        switch (months) {
            case 12:
                sum += 30;
            case 11:
                sum += 31;
            case 10:
                sum += 30;
            case 9:
                sum += 31;
            case 8:
                sum += 31;
            case 7:
                sum += 30;
            case 6:
                sum += 31;
            case 5:
                sum += 30;
            case 4:
                sum += 31;
            case 3:
                sum += 28;
                if (years % 100 != 0 && years % 4 == 0 || years % 400 == 0) {
                    sum += 1;


                }
            case 2:
                sum += 31;
            case 1:
                sum += day;
                break;
        }
        System.out.println("第" + sum + "天");


    }

}


